package spitfire.ksim.algorithm;

import java.util.List;

/**
 * <p>
 * Interface for classification algorithms which compares a raw data list to a
 * list of {@link FuzzyEntry} and select a semantic description with the
 * similarity score.
 * </p>
 * <p>
 * Already known implementations: {@link KNearestNeighbor}, {@link SumTopK}.
 * </p>
 * 
 * @author Adam
 */
public interface LazyClassificationAlgorithm {

	/**
	 * Inner class to store a similarity score with the corresponding {@link FuzzyEntry}.
	 * @author Adam
	 */
	class Pair implements Comparable<Pair>{
		public Pair(double score, FuzzyEntry entry) {
			this.score = score;
			this.entry = entry;
		}
		public double score;
		public FuzzyEntry entry;
		@Override
		public int compareTo(Pair o) {
			return Double.compare(this.score, o.score);
		}
	}
	
	/**
	 * Do classification to get a semantic description with raw data and
	 * a list of {@link FuzzyEntry}.
	 * 
	 * @param timeStampList - raw data time stamp.
	 * @param dataList - raw data value.
	 * @param entryList - fuzzy entry list.
	 * @return the classified semantic description.
	 */
	public String classifySD(List<Long> timeStampList, List<Double> dataList, List<FuzzyEntry> entryList);
	
	/**
	 * @return the similarity score for the last classification.
	 */
	public double getSimilarity();
}
